﻿using System;

namespace MDT.LifeSewagePlatform.Conmmon
{
    public class CacheTokenEntity
    {
        private string token;
        private DateTime expired;
        public CacheTokenEntity(string token,int minute=30)
        {
            SetToken(token,minute);
        }

        public void SetToken(string token, int minute = 30)
        {
            this.token = token;
            expired = DateTime.Now.AddMinutes(minute);
        }
        public string GetToken()
        {
            return token;
        }
        /// <summary>
        /// false-未过期
        /// </summary>
        /// <returns></returns>
        public bool IsExpired()
        {
            if (DateTime.Now<=expired)
            {
                return false;
            }
            return true;
        }

    }
}
